<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            width: 80px;
            height: 80px;
            /* background-color: green; */
        }
    </style>
</head>

<body>
    <div></div><br>
    <button class="a">红</button>
    <button class="b">黄</button>
    <button class="c">蓝</button><br>
    <button class="p">200</button>
    <button>300</button>
    <button>400</button><br>
    <button>200</button>
    <button>300</button>
    <button>400</button><br>

</body>

</html>
<script>
    var div = document.querySelector('div');
    var a = document.querySelector('.a');
    a.onclick = function () {
        div.style.background = 'red';
    }
    var b = document.querySelector('.b');
    b.onclick = function () {
        div.style.background = 'green';
    }
    var c = document.querySelector('.c');
    c.onclick = function () {
        div.style.background = 'red';
    }
    var p = document.querySelector('.p');
    p.onclick = function () {
        div.style.width = '100px';
    }








</script>